#!/usr/bin/env python3
# -*- encoding: utf-8 -*-

__author__ = "Yunpeng Li <ypli.chn@outlook.com.com>"
from EU.admin.BroadcastBox import BroadcastBox
import json
def get_broadcast(device_id):
    return json.dumps(BroadcastBox().get_broadcast(device_id))


def get_all_broadcast():
    result = []
    for broadcast in BroadcastBox().broadcast_list:
        result.append({
            "id":broadcast.id,
            "date":broadcast.date.timestamp(),
            "message":broadcast.message,
            "poster":broadcast.admin.username
        })
    return json.dumps(result)

def main():
    pass


if __name__ == '__main__':
    main()
